package com.bite.mybatis.plus.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.bite.mybatis.plus.model.Userinfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserInfoMapper extends BaseMapper<Userinfo> {

//    @Select("select id,username,password,age FROM user_info WHERE username = #{name}")
    @Select("select id,username,password,age FROM user_info ${ew.customSqlSegment}")
    List<Userinfo> selectByCustom(@Param(Constants.WRAPPER) Wrapper wrapper);


    List<Userinfo> selectByCustom2(@Param(Constants.WRAPPER) Wrapper wrapper);


    @Update("update user_info set age = age + #{age} ${ew.customSqlSegment}")
    Integer updateByCustom(@Param("age") Integer age, @Param(Constants.WRAPPER) Wrapper wrapper);

}
